package com.yunwaikeji.gy_tool_library.utils.http.download;

import com.yunwaikeji.gy_tool_library.base.GYBaseUtils;
import com.yunwaikeji.gy_tool_library.utils.http.GYHttpModel;

import java.io.File;

public class GYDownloadModel<Model extends GYDownloadModel<Model>> extends GYHttpModel<Model> {
    private File cacheDirectory = GYBaseUtils.getCacheDirectory();//缓存路径文件夹
    private int cacheSize = 1024;//缓存大小
    private File downloadDirectory = GYBaseUtils.getDownloadDirectory();//下载路径文件夹
    private String name;//文件名
    private boolean reStart;//是否重新开始

    public File getCacheDirectory() {
        return cacheDirectory;
    }

    public Model setCacheDirectory(File cacheDirectory) {
        this.cacheDirectory = cacheDirectory;
        return getModel();
    }

    public Model setCacheDirectory(String cacheDirectory) {
        return setCacheDirectory(new File(cacheDirectory));
    }

    public int getCacheSize() {
        return cacheSize;
    }

    public Model setCacheSize(int cacheSize) {
        this.cacheSize = cacheSize;
        return getModel();
    }

    public File getDownloadDirectory() {
        return downloadDirectory;
    }

    public Model setDownloadDirectory(File downloadDirectory) {
        this.downloadDirectory = downloadDirectory;
        return getModel();
    }

    public Model setDownloadDirectory(String downloadDirectory) {
        return setDownloadDirectory(new File(downloadDirectory));
    }

    public String getName() {
        return name;
    }

    public Model setName(String name) {
        this.name = name;
        return getModel();
    }

    public boolean isReStart() {
        return reStart;
    }

    public Model setReStart(boolean reStart) {
        this.reStart = reStart;
        return getModel();
    }
}
